//
//  XZTestDetailFirstCell.m
//  Teecloud
//
//  Created by PC on 2018/12/25.
//  Copyright © 2018年 小志. All rights reserved.
//

#import "XZTestDetailFirstCell.h"
#import "XZTimeRoomInfos.h"

@interface XZTestDetailFirstCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
//应到
@property (weak, nonatomic) IBOutlet UILabel *countLabel;
//缺考
@property (weak, nonatomic) IBOutlet UILabel *loseCountLabel;
//未交卷
@property (weak, nonatomic) IBOutlet UILabel *testingCountLabel;
//合格人数
@property (weak, nonatomic) IBOutlet UILabel *passCountLabel;
//合格率
@property (weak, nonatomic) IBOutlet UILabel *passRateLabel;
//平均分
@property (weak, nonatomic) IBOutlet UILabel *avgScoreLabel;

@end
#define PerformColor [UIColor colorWithHexString:@"128B03" andAlpha:1.0f]
@implementation XZTestDetailFirstCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setModel:(XZTimeRoomInfos *)model{
    _model = model;
    
  self.titleLabel.text = [NSString stringWithFormat:@"%@    %@",model.TimeName,model.RoomName];
    if ([model.StatusCode isEqualToNumber:@(1)]) {
        self.statusLabel.text = @"未开始";
        self.statusLabel.textColor = kRedColor;
    }else if ([model.StatusCode isEqualToNumber:@(2)]){
        self.statusLabel.text = @"考试中";
         self.statusLabel.textColor = [UIColor colorWithHexString:@"FF7708" andAlpha:1.0f];
    }else if ([model.StatusCode isEqualToNumber:@(3)]){
        self.statusLabel.text = @"已结束";
         self.statusLabel.textColor = kDarkGrayColor;
    }
    
    //应到
    self.countLabel.text = [NSString stringWithFormat:@"%@人",model.Count];
    //缺考
    self.loseCountLabel.text = [NSString stringWithFormat:@"%@人",model.LoseCount];
    if ([model.LoseCount integerValue] == 0) {
        self.loseCountLabel.textColor = kBlackColor;
    }else{
        self.loseCountLabel.textColor = kRedColor;
    }
     //未交卷
    self.testingCountLabel.text = [NSString stringWithFormat:@"%@人",model.TestingCount];
    //合格
    self.passCountLabel.text = [NSString stringWithFormat:@"%@人",model.PassCount];
    if ([model.PassCount integerValue] == 0) {
        self.passCountLabel.textColor = kBlackColor;
    }else{
        self.passCountLabel.textColor = PerformColor;
    }
    
    //合格率
    self.passRateLabel.text = [NSString stringWithFormat:@"%@%@",model.PassRate,@"%"];
    //平均分
    self.avgScoreLabel.text = [NSString stringWithFormat:@"%@",model.AvgScore];
}

@end
